package alibaba.java8datetimeapi;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Set;

/**
 * @author ChangLiang
 * @date 2020/4/17
 */
public final class Util {

    /**
     * How to sort Date which is in string format in java?
     * @param dates
     * @return
     */
    public static ArrayList convertToSortedArrayList(Set<String> dates) {
        ArrayList list = new ArrayList();
        dates.stream().forEach((date)->list.add(date));
        Collections.sort(list, (Comparator<String>) Comparator.naturalOrder());
        return list;
    }
}
